﻿using System;
using System.Configuration;
using MSAcademic.v2.Infrastructure.Article;

namespace MSAcademic.v2.Web.Areas.Admin.Models.Picture
{
     public partial class EditArticleThumbnailViewModel
     {
        public int ArticleId { get; set; }
        public int ThumbnailWidth
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["ArticleThumbnailPictureWidth"]); }
        }

        public int ThumbnailHeight
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["ArticleThumbnailPictureHeight"]); }
        }
        public double ThumbnailX1 { get; set; }
        public double ThumbnailY1 { get; set; }
        public double ThumbnailX2 { get; set; }
        public double ThumbnailY2 { get; set; }
        
     }

     public partial class EditArticleThumbnailViewModel
     {
         public string ThumbnailUrl
         {
             get
             {
                 if (_thumbnailUrl == null)
                 {
                     _thumbnailUrl = new Lazy<string>(() => _articleQueries.GetArticle(ArticleId).PictureUrlThumbnail);
                 }
                 return _thumbnailUrl.Value;
             }
         }
         private Lazy<string> _thumbnailUrl;
     }
     public partial class EditArticleThumbnailViewModel
     {
         public IArticleQueries _articleQueries { get; set; }
         public EditArticleThumbnailViewModel (IArticleQueries articleQueries)
         {
             _articleQueries = articleQueries;
         }
         public EditArticleThumbnailViewModel()
         {
             
         }
     }

}